﻿@using Microsoft.AspNetCore.Components.Rendering
@namespace Microsoft.FluentUI.AspNetCore.Components

@if (_toastList.Any())
{
    <div class="fluent-toast-provider @_positionClass">
        <CascadingValue TValue="InternalToastContext" IsFixed="true" Value="@_internalToastContext">
            @_renderToasts
        </CascadingValue>
    </div>

}

@code {
    protected void RenderToasts(RenderTreeBuilder __builder)
    {
        @foreach (ToastInstance toast in _toastList.OrderBy(x => x.Parameters.Timestamp))
        {
            <FluentToast @key="@toast" Id="@toast.Id" Instance="@toast"  Data="@toast.Content"/>
        }
    }
}
